<template>
	<view style="padding: 30rpx;">
		<u-input v-model="content" type="textarea" :border="true" :height="210" :auto-height="autoHeight"
			:placeholder="$t('请输入投诉建议')" class="textarea" />
		<view style="margin-top:30rpx">
			<u-button class="submit" hover-class="none" type="primary" @click="sub">
				{{ $t('提交') }}
			</u-button>
		</view>
	</view>
</template>

<script>
	// 投诉建议
	export default {
		data() {
			return {
				content: "",
				//按钮样式
				customStyle: {
					width: '429rpx',
					height: '78rpx',
					background: 'linear-gradient(110deg, #DD2910 0%, #F79B29 100%)',
					'border-radius': '26rpx'
				},
			}
		},
		onReady() {
			uni.setNavigationBarTitle({
				title: this.$t("投诉建议")
			})
		},
		methods: {
			sub() {
				if (!this.content) {
					this.$u.toast(this.$t('请输入内容'));
					return false
				}
				let me = this;
				uni.showModal({
					content: me.$t("确认提交") + "?",
					cancelText: this.$t('否'),
					confirmText: this.$t('是'),
					success(resModal) {
						if (resModal.confirm) {
							me.$u.api.feedback.sendAdvice({
								advice: me.content
							}).then(res => {
								me.$u.toast(me.$t("已提交"))
								setTimeout(() => {
									uni.navigateBack({
										delta: 1
									})
								}, 1500)
							})
						}
					}
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.submit {
		width: 602rpx;
		height: 90rpx;
		border-radius: 16rpx;
		background: #000000;
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		bottom: 15%;
		left: 50%;
		transform: translateX(-50%);
		font-size: 28rpx;
	}

	.textarea {
		border: 1rpx solid #CED9E2;
	}
</style>